package com.a85.wxhelper;

import android.app.Activity;
import android.app.Application;
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.VersionedPackage;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.a85.wxhelper.bean.ContactInfo;
import com.a85.wxhelper.bean.GetCurrentTime;
import com.a85.wxhelper.bean.InstalledModule;
import com.a85.wxhelper.bean.LuckMoneyBean;
import com.a85.wxhelper.bean.MessageBean;
import com.a85.wxhelper.db.DBUtil;
import com.a85.wxhelper.http.BaseObserver;
import com.a85.wxhelper.http.HttpApi;
import com.a85.wxhelper.util.AppUtils;
import com.a85.wxhelper.util.Constants;
import com.a85.wxhelper.util.Tools;
import com.google.gson.Gson;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.json.JSONObject;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

import static com.a85.wxhelper.db.DBUtil.GetFolder;
import static com.a85.wxhelper.db.DBUtil.getRoot;


/**
 * @author hejiangwei
 * Created at 2018/6/26.
 * com.a85.wxhelper.WXMain
 */
public class WXMain implements IXposedHookLoadPackage {
    private Constructor constructor;
    private Method getRotation;
    private Object IWindowManager;
    private String TAG = WXMain.class.getSimpleName();
    private CommonHook commonHook;
    private Context mContext, mwxContext;

    private boolean mBoolean= false;

    private XC_LoadPackage.LoadPackageParam mlpparam=null;


    PackageManager mPm;
    //de.robv.android.xposed.installer
    //de.robv.android.xposed.installer.WelcomeActivity
    @Override
    public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {


        if (lpparam.packageName.equals(Constants.PACKAGE_NAME)  ) {
            mlpparam=lpparam;
            commonHook = CommonHook.getInstance();
            if (mContext == null) {
                mContext = commonHook.getContext();

                //获取wechat版本

                //xposed安装器的模块列表在Android 7以上的文件路径
//                File file=new File("/data/user_de/0/de.robv.android.xposed.installer/conf/modules.list");

                commonHook.initWechatVersion(mContext);
            }
            if (mPm==null){
                mPm=mContext.getPackageManager();
            }

            //获取Xposed安装器的模块信息，暂无后续操作
            List<String> applist=new ArrayList<>();
            for (PackageInfo pkg : mPm.getInstalledPackages(PackageManager.GET_META_DATA)) {
                ApplicationInfo app = pkg.applicationInfo;
                if (!app.enabled)
                    continue;
                InstalledModule installed = null;
                if (app.metaData != null && app.metaData.containsKey("xposedmodule")) {
                    installed = new InstalledModule(pkg, false);
                    Log.e(TAG, "handleLoadPackage------"+installed.app.sourceDir );
//                    put(installed.app.sourceDir);
                }
            }



            Toast.makeText(mContext, "set-------" + CommonHook.wechatVersionName, Toast.LENGTH_SHORT).show();
            //确保wx已经attach，应对多dex文件情况
            XposedHelpers.findAndHookMethod(Application.class, "attach",
                Context.class, new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        final Context context = ((Context) param.args[0]);
                        Log.e(TAG, "afterHookedMethod========" + context.getPackageName());

                        mwxContext = context;
                        hookMultiClound(context);
                        DBUtil.getInstance(context).Open();

                    }
                });


        }
//用于启动 xposed安装器
//        Intent intent = new Intent();
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//        intent.setComponent(new ComponentName(
//                "de.robv.android.xposed.installer",
//                "de.robv.android.xposed.installer.WelcomeActivity"));
//        startActivity(intent);

        //防止使用人员误触安装器，所以做了安装器的第一次打开时把安装器移到后台的操作
        if (lpparam.packageName.equals("de.robv.android.xposed.installer")  ){
            XposedHelpers.findAndHookMethod("de.robv.android.xposed.installer.WelcomeActivity",
                    lpparam.classLoader,"onCreate",Bundle.class,new XC_MethodHook(){
                        @Override
                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                            super.afterHookedMethod(param);
                            ((Activity)param.thisObject).moveTaskToBack(true);
                        }
                    });

        }

    }

    private void hookMultiClound(final Context context) {

        final ClassLoader cl = context.getClassLoader();
        Class<?> hookclass = null;
        Class<?> hostDB = null;
        Class<?> hostSQLiteStatement = null;

        try {
            hookclass = cl.loadClass(Constants.CLASS_ChattingListClick);
            hostDB = cl.loadClass(Constants.CLASS_INSER_DB);
            hostSQLiteStatement = cl.loadClass(Constants.CLASS_Cursor);
        } catch (Exception e) {
        XposedBridge.log("------类存在e-------"+e.getLocalizedMessage());
            return;
        }

        XposedBridge.log("------类存在-------");
        Log.e(TAG, "hookMultiClound===-----" + initCurrWxUin());




        //进入会话页面时
        XposedHelpers.findAndHookMethod(hookclass,
                Constants.TAG_START_CHATTING,
                String.class, Bundle.class, boolean.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("status--------startChat-------");


                        boolean isRunning = AppUtils.isServiceRunning(mwxContext, Constants.FLOAT_Service_NAME);

                        String userName = (String) (param.args[0]);
                        //如果是用户或者群组的话才进行处理，其余公众号、系统通知等不做处理
                        if (userName.startsWith("wxid_") || userName.endsWith("@chatroom")) {

                            final String nickName=commonHook.getCursor(userName);


                            if (!isRunning) {
                                openFloat();
                                new Handler().postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                            sendStartChatting(nickName);
                                    }
                                }, 500);
                            } else {
                                sendStartChatting(nickName);
                            }
                            return;
                        }
                        if (!isRunning) {
                            openFloat();
                        }
                    }
                });

        //关闭会话页面
        XposedHelpers.findAndHookMethod(hookclass,
                Constants.TAG_CLOSE_CHATTING,
                boolean.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("status--------closeChat-------");
                        sendStopChatting();

                    }
                });


        //sns.ui.SnsTimelineUI    adapter
        Class<?> activity= XposedHelpers.findClass("com.tencent.mm.ui.MMActivity",mlpparam.classLoader);
        Class<?> classB= XposedHelpers.findClass("com.tencent.mm.plugin.sns.ui.b.b",mlpparam.classLoader);
        Class<?> classJ= XposedHelpers.findClass("com.tencent.mm.plugin.sns.ui.j",mlpparam.classLoader);
        XposedHelpers.findAndHookConstructor("com.tencent.mm.plugin.sns.ui.ax",
                mlpparam.classLoader,activity,ListView.class,classB,classJ,String.class,
                new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        super.beforeHookedMethod(param);

                        XposedBridge.log("status--------mm.plugin.sns.storage.o----"+param.args[4]);

                    }
                });



        //朋友圈查询数据方法
        XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.sns.model.aw",
                mlpparam.classLoader,"byV",
                new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        super.beforeHookedMethod(param);

                        XposedBridge.log("status--------com.tencent.mm.plugin.sns.model.aw---");

                    }
                });

        Class<?> classBb= XposedHelpers.findClass("com.tencent.mm.sdk.b.b",mlpparam.classLoader);


        try {
        final Class<?> hoststorage = cl.loadClass("com.tencent.mm.plugin.sns.storage.n");
            XposedHelpers.findAndHookMethod(hoststorage,"d",Cursor.class,
                    new XC_MethodHook() {
                        @Override
                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                            super.afterHookedMethod(param);

                            Field f=XposedHelpers.findField(hoststorage,"field_content");
                            byte[] bytes= (byte[]) f.get(param.thisObject);
                            Tools.getInfo(bytes);
                            XposedBridge.log("status--------com.tencent.mm.plugin.sns.storage.n---"+(new String(bytes)));

                        }
                    });

        } catch (Exception e) {
            XposedBridge.log("------类存在e-------"+e.getLocalizedMessage());
            return;
        }

////        com.tencent.mm.plugin.sns.storage.e   F方法 不执行
            XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.sns.storage.e",
                    mlpparam.classLoader,"bAM",
                    new XC_MethodHook() {
                        @Override
                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                            super.afterHookedMethod(param);
                            XposedBridge.log("status--------com.tencent.mm.plugin.sns.storage.e-bAMbAMbAM----");

                        }
                    });
//




        //接收到红包后第一次打开，会走LuckyMoneyReceiveUI   --->  LuckyMoneyDetailUI
        XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyReceiveUI",
                mlpparam.classLoader,"onResume",
                new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        super.beforeHookedMethod(param);
                        mBoolean=true;

                    }
                });
        final Class<?> cf=XposedHelpers.findClass("com.tencent.mm.plugin.luckymoney.b.f",
                mlpparam.classLoader);

        try {
            final Class<?> hookMoney= cl.loadClass("com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyDetailUI");
            XposedHelpers.findAndHookMethod(hookMoney,"a", cf,
                    new XC_MethodHook() {
                        @Override
                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                            super.afterHookedMethod(param);
                            if (mBoolean){
                                String json=Constants.beanToString(param.args[0]);//数据类转json数据

                                Gson gson = new Gson();
                                LuckMoneyBean moneyBean=gson.fromJson(json,LuckMoneyBean.class);

                                if (moneyBean.getCfh()==0){
                                    //代表是我发的红包
                                    return;
                                }
                                XposedBridge.log("红包-------json="+json);
                                XposedBridge.log("红包-------发送者="+moneyBean.getKQg()+"=昵称="+moneyBean.getKPL() +"==金额=="+moneyBean.getCfh()+"==备注信息=="+moneyBean.getKLf()+"==\n"+
                                    "接收者ID="+moneyBean.getKQe().get(0).getUserName()+"==昵称=="+moneyBean.getKQe().get(0).getKQC()+"=领到金额="+moneyBean.getKQe().get(0).getKQp()+"=时间="+moneyBean.getKQe().get(0).getKQq());

                            }

                        }
                    });


        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }




        getDbPsd();


        hookStatus(hookclass);

        //监控数据库插入操作
        XposedHelpers.findAndHookMethod(hostDB,
                Constants.TAG_INSERT,
                String.class, String.class, ContentValues.class, int.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        boolean isRunning = AppUtils.isServiceRunning(mwxContext, Constants.FLOAT_Service_NAME);
                        if (!isRunning) {
//                            int x = (int)getRotation.invoke(IWindowManager,false,"param");
//                            XposedBridge.log("invoke-------" + x);
                            openFloat();
                            new Handler().postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    printInsertInfo(param, context);
                                }
                            }, 500);
                        } else {
                            printInsertInfo(param, context);
                        }


                    }
                });





        XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.fts.f",
                mlpparam.classLoader,"Co",
                String.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        String json=Constants.beanToString(param.getResult());
                        XposedBridge.log("cursor==rcontact====" +json);
                    }
                });


        XposedHelpers.findAndHookMethod(hostSQLiteStatement,
                Constants.TAG_CURSOR,
                String.class, String[].class, int.class,
                new XC_MethodHook() {

                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("cursor======" +param.args[0]);

                        //存储param.thisObject，方便查询操作
                        commonHook.setThisObject(param.thisObject);


                    }
                });



        //监控数据库更新操作
        XposedHelpers.findAndHookMethod(hostDB,
                Constants.TAG_UPDATE,
                String.class, ContentValues.class, String.class, String[].class, int.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);

                        printUpdateInfo(param, context);
                    }
                });

        //构造方法 XposedHelpers.findAndHookConstructor

        //点击wx底部tab的事件
        //XposedHelpers.findClass(CLASS_BOTTOM, cl),"jZ",int.class
        //聊天列表Item点击事件
        //XposedHelpers.findClass(CLASS_ChattingList, cl),"onItemClick",AdapterView.class, View.class, int.class, long.class,
    }

    //监控SQLiteConnectionPool的open方法得到数据库密码
    private void getDbPsd() {
        Class cSQLiteDatabase= XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteDatabase",
                mlpparam.classLoader);
        Class cSQLiteDatabaseConfiguration=XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteDatabaseConfiguration",
                mlpparam.classLoader);
        Class cSQLiteCipherSpec=XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteCipherSpec",
                mlpparam.classLoader);


        XposedHelpers.findAndHookMethod("com.tencent.wcdb.database.SQLiteConnectionPool",
                mlpparam.classLoader,"open",
                cSQLiteDatabase,cSQLiteDatabaseConfiguration,byte[].class,cSQLiteCipherSpec,int.class,
                new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        super.beforeHookedMethod(param);
                        XposedBridge.log("status--------open-------" +new String((byte[]) param.args[2]));

                    }
                });


    }

    //监控LauncherUI的生命周期
    private void hookStatus(Class<?> hookclass) {
        XposedHelpers.findAndHookMethod(hookclass,
                Constants.TAG_ON_RESUME,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("status--------onResume-------");
                        mBoolean= false;
                        seneOnResume();

                    }
                });

        XposedHelpers.findAndHookMethod(hookclass,
                Constants.TAG_ON_STOP,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("status--------stop-------");
                        sendOnStop();

                    }
                });


        XposedHelpers.findAndHookMethod(hookclass,
                Constants.TAG_ON_Create, Bundle.class,
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("status--------create-------");
                        sendOnCreate();
                    }
                });
    }

    /**
     * @return 解析出wx的uin码
     * MD5("mm"+uin码) 生成的md5就是EnMicroMsg.db所处的父级文件夹的名称
     */
    public static String initCurrWxUin() {
        String mCurrWxUin = null;
        File file = new File(Constants.WX_SP_UIN_PATH);
        try {
            FileInputStream in = new FileInputStream(file);
            SAXReader saxReader = new SAXReader();
            Document document = saxReader.read(in);
            Element root = document.getRootElement();
            List<Element> elements = root.elements();
            for (Element element : elements) {
                if ("_auth_uin".equals(element.attributeValue("name"))) {
                    mCurrWxUin = element.attributeValue("value");
                    break;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("123456", "获取wx uid失败，请检查auth_info_key_prefs文件权限");
        } finally {

            return mCurrWxUin;
        }
    }

    /**
     * 打开悬浮球app
     */
    private void openFloat() {
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setComponent(new ComponentName(
                Constants.FLOAT_PACKAGE_NAME,
                Constants.FLOAT_LAUNCH));
//        mContext.startActivity(intent);
    }

    /**
     * 把聊天者的信息以发送广播的形式发给悬浮球app
     *
     * @param info 正要聊天者的信息，wx号和昵称
     */
    private void sendStartChatting(String info) {
        Intent intent = new Intent();
        intent.setAction(Constants.Action_Chatting);
        intent.putExtra(Constants.TAG_START_CHATTING, info);
        mContext.sendBroadcast(intent);

    }

    /**
     * wx关闭与某人的聊天界面
     */
    private void sendStopChatting() {
        Intent intent = new Intent();
        intent.setAction(Constants.Action_Chatting);
        intent.putExtra(Constants.TAG_CLOSE_CHATTING, true);
        mContext.sendBroadcast(intent);

    }

    /**
     * LauncherUI界面可交互
     */
    private void seneOnResume() {
        Intent intent = new Intent();
        intent.setAction(Constants.Action_Chatting);
        intent.putExtra(Constants.TAG_ON_RESUME, true);
        mContext.sendBroadcast(intent);

    }

    /**
     * LauncherUI界面不可见了
     */
    private void sendOnStop() {
        Intent intent = new Intent();
        intent.setAction(Constants.Action_Chatting);
        intent.putExtra(Constants.TAG_ON_STOP, true);
        mContext.sendBroadcast(intent);

    }

    /**
     * LauncherUI界面的OnCreate
     */
    private void sendOnCreate() {
        Intent intent = new Intent();
        intent.setAction(Constants.Action_Chatting);
        intent.putExtra(Constants.TAG_ON_Create, true);
        mContext.sendBroadcast(intent);

    }

    /**
     * 接收数据的话能够得到msgSvrId，如果是发送数据的话需要在Update方法中得到msgSvrId
     * isSend
     *
     * @param param
     * @param context
     */
    private void printInsertInfo(XC_MethodHook.MethodHookParam param, Context context) {
        String tableName = (String) param.args[0];
        String str1 = (String) param.args[1];//主键字段名
        XposedBridge.log("Insert----tablename===:" + tableName + "-----" + str1 + "\n");


        if (TextUtils.equals(tableName,"SnsComment")){
            //有人点赞了，
            ContentValues contentValues = (ContentValues) param.args[2];
            //"snsID"//朋友圈消息ID
            //"createTime"//朋友圈消息时间戳
            //"talker"//点赞评论者的wxID
            //"isRead"//是否已读，0未读，1已读
            //"type"//类型，1点赞，2评论


            return;
        }

        if (TextUtils.equals(tableName,Constants.TABLE_RCONTACT)){
            StringBuffer stringBuffer=new StringBuffer("values=");
            ContentValues contentValues = (ContentValues) param.args[2];
            for (String s : contentValues.keySet()) {
                stringBuffer.append("ksy="+s+"=values="+contentValues.get(s)+"==\n");
            }

            XposedBridge.log(stringBuffer.toString());
            return;
        }
        if (!Constants.TABLE_MESSAGE.equals(tableName)) {
            return;
        }

        //处理消息数据
        ContentValues contentValues = (ContentValues) param.args[2];
        String nickName=commonHook.getCursor((String) contentValues.get("talker"));

        MessageBean messageBean = new MessageBean.Builder()
                .isSend(((int) contentValues.get("isSend")) == 1)
                .userId((String) contentValues.get("talker"))
                .msgType((int) contentValues.get("type"))
                .content((String) contentValues.get("content"))
                .msgId((long) contentValues.get("msgId"))
                .nickName(nickName)
                .build();

        XposedBridge.log("\n-------------插入数据START--------" + contentValues.get("msgId")+"\n"+contentValues.get("msgSvrId")+"\n"+
                contentValues.get("type")+"\n"+contentValues.get("status")+"\n"+
                contentValues.get("isSend")+"\n"+contentValues.get("createTime")+"\n"+
                contentValues.get("talker")+"\n"+contentValues.get("content")+"\n"+
                contentValues.get("imgPath")

        );
        DBUtil.getInstance(mwxContext).insertMsg(contentValues);
        sendChatMessage(messageBean);


    }

    private void printUpdateInfo(XC_MethodHook.MethodHookParam param, Context context) {
        String tableName = (String) param.args[0];
            String str1 = (String) param.args[2];
        XposedBridge.log("Update----tablename===:" + tableName + "-----" + str1 + "\n");

        if (TextUtils.equals(Constants.TABLE_MESSAGE, tableName)) {
            //更新消息数据表中的信息

            String[] strs = (String[]) param.args[3];
            ContentValues contentValues = (ContentValues) param.args[1];
            XposedBridge.log("tablename===:" + tableName + "-----" + str1 + "---" + Arrays.toString(strs) + "\n");
            for (String key : contentValues.keySet()) {
                if ("content".equals(key)) {
                    Toast.makeText(context, (String) contentValues.get(key), Toast.LENGTH_SHORT).show();
                }
                XposedBridge.log("key--:" + key + ":------:" + "value---:" + contentValues.get(key) + "\n");
            }
            XposedBridge.log("\n-------------更新数据END--------\n");
            DBUtil.getInstance(mwxContext).updateMessage((String) contentValues.get("msgSvrId"), (Integer) contentValues.get("msgSvrId"));
        }

    }

    /**
     * 把聊天信息以发送广播的形式发给悬浮球app
     *
     * @param messageBean 插入数据库的聊天信息
     */
    private void sendChatMessage(MessageBean messageBean) {

        Intent intent = new Intent();
        intent.setAction(Constants.Action_Message);
        intent.putExtra(Constants.TAG_CHAT_MESSAGE, Constants.beanToString(messageBean));
        mContext.sendBroadcast(intent);


        //模拟网络请求，暂无后续操作
        HttpApi.getInstance().getVersion()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseObserver<GetCurrentTime>() {
                    @Override
                    protected void onSucceed(GetCurrentTime getCurrentTime) {

                        Log.e(TAG, "onSucceed---"+getCurrentTime.getData().getTime());
                        //执行消息删除操作
                    }

                    @Override
                    public void onFail(Throwable e) {

                    }
                });

    }


}